import { NativeModules, NativeEventEmitter } from 'react-native';

const { RabbitMQModule } = NativeModules;

export interface CallTaskMessage {
  phone: string;
  deviceId: string;
  time: string;
}

export interface RabbitMQModuleType {
  startRabbitMQ(): Promise<string>;
  stopRabbitMQ(): Promise<string>;
  getDeviceId(): Promise<string>;
  getQueueName(): Promise<string>;
  isConnected(): Promise<boolean>;
  setDeviceId(deviceId: string): Promise<string>;
}

export const rabbitMQModule = RabbitMQModule as RabbitMQModuleType;

export const rabbitMQEventEmitter = new NativeEventEmitter(RabbitMQModule);

export default rabbitMQModule;
